require "test/unit"
class AboutTrueAndFalse<Test::Unit::TestCase
  def truth_value(condition)
    if condition
      :true_stuff
    else
      :false_stuff
    end
  end 
  # 如果有条件，则为真， 否则为假
  def test_string1
    assert_equal :true_stuff, truth_value(true)
  end
  # true作为真值

  def test_string2
    assert_equal :false_stuff, truth_value(false)
  end
  # false做为非真值

  def test_string3
    assert_equal :false_stuff, truth_value(nil)
  end
  # nil 同样作为非真值


  def test_string3
    assert_equal :true_stuff, truth_value(1)
    assert_equal :true_stuff, truth_value(0)
    assert_equal :true_stuff, truth_value([]) 
    assert_equal :true_stuff, truth_value({})
    assert_equal :true_stuff, truth_value("strings")
    assert_equal :true_stuff, truth_value("")
  end
  # 只要condition不为空，不为false不为nil，则都为真值
end
